package actionManager;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class JDBCConnection {
	
	private String driverName;
	private String serverName;
	//private String port;
	private String mydatabase;
	private String username;
	private String password;
	private String url;
	
	public JDBCConnection(){
		driverName = "com.mysql.jdbc.Driver";
		serverName = "localhost";
		//port = "3306";
		mydatabase = "its";
		username = "root";
		password = "admin";
		url = "jdbc:mysql://"+serverName+"/"+mydatabase;
	}
	
	public Connection getConnection(){
		Connection conn=null;
		try{
			Class.forName(driverName).newInstance();
			conn = DriverManager.getConnection(url,username,password);
		}catch(ClassNotFoundException e){
			e.printStackTrace();
		}catch(SQLException e){
			e.printStackTrace();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		}
		return conn;
	}

}
